const express = require('express');
const router = express.Router();
const authController = require('../../controllers/authController');
const { validateRequest } = require("../../middleware/validationMiddleware");
const { body } = require("express-validator");

// 获取验证码接口
router.get('/captcha', authController.getCaptcha);

// 登录接口
router.post('/login', [
    body("username").notEmpty().withMessage("用户名不能为空"),
    body("password").notEmpty().withMessage("密码不能为空"),
    body("captchaKey").notEmpty().withMessage("验证码key不能为空"),
    body("captchaCode").notEmpty().withMessage("验证码不能为空"),
  ],
  validateRequest,
   authController.login);

module.exports = router;